<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('操作日志列表')" />
	<th:block th:include="include :: bootstrap-select-css" />
</head>
<body class="gray-bg">
	<div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="operlog-form">
					<div class="select-list">
						<ul>
							<li>
								<label>订单ID： </label><input type="text" name="title"/>
							</li>
							<li>
								<label>卖家ID： </label><input type="text" name="operName"/>
							</li>
							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="searchPre()"><i class="fa fa-search"></i>&nbsp;搜索</a>
								<a class="btn btn-warning btn-rounded btn-sm" onclick="resetPre()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>

			<div class="btn-group-sm" id="toolbar" role="group">
	            <a class="btn btn-warning" onclick="$.table.exportExcel()" >
		            <i class="fa fa-download"></i> 导出
		        </a>
	        </div>
	        
			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table"></table>
			</div>
		</div>
	</div>
	
	<th:block th:include="include :: footer" />
	<th:block th:include="include :: bootstrap-select-js" />
	<script th:inline="javascript">
		var prefix = ctx + "orderController";

		$(function() {
		    var options = {
		        url: prefix + "/list",
		        detailUrl: prefix + "/details/{id}",
		        sortName: "operTime",
		        sortOrder: "desc",
		        modalName: "订单列表",
		        escape: true,
		        showPageGo: true,
		        rememberSelected: true,
		        columns: [
		        {
		            field: 'orderId',
		            title: '订单ID',
					sortable: true
				},
		        {
		            field: 'memberId',
		            title: '会员ID'
		        },
		        {
		            field: 'shopName',
		            title: '卖家名字'
		        },
		        {
		            field: 'payTime',
		            title: '支付时间'
		        },

		        {
		            field: 'paymoney',
		            title: '支付金额'
		        },
				{
					field: 'address',
					title: '快递地址'
				},
				{
					field: 'expressfee',
					title: '运费'
				},
					{
						field: 'orderStatus',
						title: '订单状态'
					},
					{
						field: 'orderStatus',
						title: '支付状态',
						align: 'center',
						formatter: function(value, row, index) {
							if (value == 0) {
								return '<span class="badge badge-primary">支付成功</span>';
							} else if (value == 1) {
								return '<span class="badge badge-danger"> 支付失败</span>';
							} else if (value == 3){
								return '<span class="badge badge-danger"> 支付待确认</span>';
							}
						}
					},
					{
						field: 'payModel',
						title: '支付方式'
					},
					{
						field: 'statusO',
						title: '退/换'
					},
		        {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		                var actions = [];
		                actions.push('<a class="btn btn-warning btn-xs " href="javascript:void(0)" onclick="$.operate.detail(\'' + row.ordersubId + '\')"><i class="fa fa-search"></i>详细</a>');
		                return actions.join('');
		            }
		        }]
		    };
		    $.table.init(options);
		});
		
		function searchPre() {
		    var data = {};
		    data.businessTypes = $.common.join($('#businessTypes').selectpicker('val'));
		    $.table.search('operlog-form', 'bootstrap-table', data);
		}
		
		function resetPre() {
			$("#operlog-form")[0].reset();
			$("#businessTypes").selectpicker('refresh');
			$.table.search('operlog-form', 'bootstrap-table');
		}
	</script>
</body>
</html>